home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2006 April / DPPRO0406DVD.ISO / Essentials / Programming / Eclipse SDK / eclipse-SDK-3.1.1-win32.exe / eclipse / plugins / org.eclipse.help.webapp_3.1.0 / advanced / tocView.jsp < prev    next >
Encoding:
Text File  |  2005-09-29  |  6.1 KB  |  219 lines

  1. <%--
  2.  Copyright (c) 2000, 2004 IBM Corporation and others.
  3.  All rights reserved. This program and the accompanying materials 
  4.  are made available under the terms of the Eclipse Public License v1.0
  5.  which accompanies this distribution, and is available at
  6.  http://www.eclipse.org/legal/epl-v10.html
  7.  
  8.  Contributors:
  9.      IBM Corporation - initial API and implementation
  10. --%>
  11. <%@ include file="header.jsp"%>
  12.  
  13. <% 
  14.     TocData data = new TocData(application,request, response);
  15.     WebappPreferences prefs = data.getPrefs();
  16. %>
  17.  
  18. <html>
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  21.  
  22. <title><%=ServletResources.getString("Content", request)%></title>
  23.  
  24. <style type="text/css">
  25. <%@ include file="tree.css"%>
  26. </style>  
  27.     
  28. <base target="ContentViewFrame">
  29. <script language="JavaScript">
  30.  
  31. // Preload images
  32. minus = new Image();
  33. minus.src = "<%=prefs.getImagesDirectory()%>"+"/minus.gif";
  34. plus = new Image();
  35. plus.src = "<%=prefs.getImagesDirectory()%>"+"/plus.gif";
  36. toc_open_img = new Image();
  37. toc_open_img.src = "<%=prefs.getImagesDirectory()%>"+"/toc_open.gif";
  38. toc_closed_img = new Image();
  39. toc_closed_img.src = "<%=prefs.getImagesDirectory()%>"+"/toc_closed.gif";
  40. folder_img = new Image();
  41. folder_img.src = "<%=prefs.getImagesDirectory()%>"+"/container_obj.gif";
  42. topic_img = new Image();
  43. topic_img.src = "<%=prefs.getImagesDirectory()%>"+"/topic.gif";
  44. altTopicClosed = "<%=UrlUtil.JavaScriptEncode(ServletResources.getString("topicClosed", request))%>";
  45. altTopicOpen = "<%=UrlUtil.JavaScriptEncode(ServletResources.getString("topicOpen", request))%>";
  46. </script>
  47.  
  48. <script language="JavaScript" src="toc.js"></script>
  49. <script language="JavaScript"> 
  50.  
  51. /**
  52.  * Loads the specified table of contents
  53.  */        
  54. function loadTOC(tocHref)
  55. {
  56.     // navigate to this toc, if not already loaded
  57.     if (window.location.href.indexOf("tocView.jsp?toc="+tocHref) != -1)
  58.         return;
  59.     window.location.replace("tocView.jsp?toc="+tocHref);
  60. }
  61.  
  62. var tocTitle = "";
  63. var tocId = "";
  64.     
  65. function onloadHandler()
  66. {
  67. <%
  68.     if (data.getSelectedToc() != -1)
  69.     {
  70. %>
  71.     tocTitle = '<%=UrlUtil.JavaScriptEncode(data.getTocLabel(data.getSelectedToc()))%>';
  72.     var tocTopic = "<%=data.getTocDescriptionTopic(data.getSelectedToc())%>";
  73.     
  74.     // set title on the content toolbar
  75.     parent.parent.parent.setContentToolbarTitle(tocTitle);
  76.         
  77.     var topicSelected=false;
  78.     // select specified topic, or else the book
  79.     var topic = "<%=data.getSelectedTopic()%>";
  80.     if (topic != "about:blank" && topic != tocTopic) {
  81.         if (topic.indexOf(window.location.protocol) != 0 && topic.length > 2) {
  82.             // remove the .. from topic
  83.             topic = topic.substring(2);
  84.             // remove advanced/tocView.jsp from path to obtain contextPath
  85.             var contextPath = window.location.pathname;
  86.             var slash = contextPath.lastIndexOf('/');
  87.             if(slash > 0) {
  88.                 slash = contextPath.lastIndexOf('/', slash-1);
  89.                 if(slash >= 0) {
  90.                     contextPath = contextPath.substr(0, slash);
  91.                     topic = window.location.protocol + "//" +window.location.host + contextPath + topic;
  92.                 }
  93.             }            
  94.         }
  95.         topicSelected = selectTopic(topic);
  96.     } else {
  97.         topicSelected = selectTopicById(tocId);
  98.     }
  99. <%
  100.     // if topic failed to be selected, but we know it exist in some book,
  101.     // offer to turn on "show all"
  102.     
  103.     // do not offer to show all just after it was manually turned off
  104.     if (null==request.getParameter("showAll")) {
  105. %>
  106.     if(!topicSelected){
  107.         if(parent.parent.activityFiltering){
  108.             askShowAll();
  109.         }
  110.     }
  111. <%
  112.     }
  113. %>
  114. <%
  115.     } else if ("yes".equals(request.getParameter("synch"))) {
  116. %>
  117.     var message='<%=UrlUtil.JavaScriptEncode(ServletResources.getString("CannotSync", request))%>';
  118.     // when we don't find the specified toc, we just restore navigation
  119.     parent.parent.parent.restoreNavigation(message);
  120. <%
  121.     }
  122. %>
  123.     focusHandler("e");
  124. }
  125.  
  126. var askShowAllDialog;
  127. var w = 470;
  128. var h = 270;
  129.  
  130. function askShowAll(){
  131. <%
  132. if (data.isIE()){
  133. %>
  134.     var l = top.screenLeft + (top.document.body.clientWidth - w) / 2;
  135.     var t = top.screenTop + (top.document.body.clientHeight - h) / 2;
  136. <%
  137. } else {
  138. %>
  139.     var l = top.screenX + (top.innerWidth - w) / 2;
  140.     var t = top.screenY + (top.innerHeight - h) / 2;
  141. <%
  142. }
  143. %>
  144.     // move the dialog just a bit higher than the middle
  145.     if (t-50 > 0) t = t-50;
  146.     
  147.     window.location="javascript://needModal";
  148.     askShowAllDialog = window.open("askShowAll.jsp", "askShowAllDialog", "resizeable=no,height="+h+",width="+w+",left="+l+",top="+t );
  149.     askShowAllDialog.focus(); 
  150. }
  151.  
  152. function yesShowAll(){
  153.     window.parent.parent.showAll();
  154. }
  155.  
  156. function closeAskShowAllDialog(){
  157.     try {
  158.         if (askShowAllDialog){
  159.             askShowAllDialog.close();
  160.         }
  161.     }
  162.     catch(e) {}
  163. }
  164.  
  165. function onunloadHandler() {
  166.     closeAskShowAllDialog();
  167. <%
  168. // for large books, we want to avoid a long unload time
  169. if (data.isIE()){
  170. %>
  171.     document.body.innerHTML = "";
  172. <%
  173. }
  174. %>
  175. }
  176.  
  177. </script>
  178. </head>
  179.  
  180.  
  181. <body dir="<%=direction%>" onload="onloadHandler()" onunload="onunloadHandler()">
  182.     <ul dir="<%=direction%>" class='expanded' id='root'>
  183. <%
  184.     for (int toc=0; toc<data.getTocCount(); toc++) {
  185.         boolean isSelected =data.getSelectedToc() != -1 &&
  186.                        data.getTocHref(data.getSelectedToc()).equals(data.getTocHref(toc));
  187.         if(!data.isEnabled(toc)){
  188.             // do not show
  189.             continue;
  190.         }
  191.         if(isSelected) {
  192. %>
  193.         <li>
  194.         <img src="<%=prefs.getImagesDirectory()%>/toc_open.gif" alt="<%=ServletResources.getString("bookOpen", request)%>"><a id="b<%=toc%>" name="opened" style="font-weight: bold;" href="<%=data.getTocDescriptionTopic(toc)%>" onclick=''><%=data.getTocLabel(toc)%></a>
  195. <%
  196.             // Only generate the selected toc
  197.             data.generateToc(toc, out);
  198.             // keep track of the selected toc id
  199. %>
  200.             <script language="JavaScript">tocId="b"+<%=toc%></script>
  201. <%
  202.         } else {
  203. %>
  204.         <li>
  205.         <img src="<%=prefs.getImagesDirectory()%>/toc_closed.gif" alt="<%=ServletResources.getString("bookClosed", request)%>"><a id="b<%=toc%>" name="<%=data.getTocHref(toc)%>" style="font-weight: bold;" href="<%=data.getTocDescriptionTopic(toc)%>" onclick='loadTOC("<%=data.getTocHref(toc)%>")'><%=data.getTocLabel(toc)%></a>
  206. <%
  207.         }
  208. %>
  209.         </li>    
  210. <%
  211.     }
  212. %>        
  213.     </ul>
  214.    <iframe name="dynLoadFrame" title="<%=ServletResources.getString("ignore", "dynLoadFrame", request)%>" style="visibility:hidden" tabindex="-1" frameborder="no" width="0" height="0" scrolling="no">
  215.     </iframe>
  216. </body>
  217. </html>
  218.  
  219.